.\" @(#)	msem182.3	2.3	6/27/94	hp
.\" 
.\" Modification history:
.\" 	2.1	Changed semantics of mP and mV
.\" 	1.1	Derived from sem182.3
.\"                                                                            *
.TH MSEM182 3 "RELEASE 2.3"
.SH NAME
mseminit, msemgrab, mP, mV, msemrm \- Semaphore field operations
.SH SYNTAX
.nf
.B #include <msem182.h>
.LP
.B "int mseminit (key_t key, int semperm, int nsems, ...);"
.B "int msemgrab (key_t key, int nsems);"
.B "int mP (int semid, int nsems, ...);"
.B "int mV (int semid, int nsems, ...);"
.B "int msemrm (int semid);"
.fi
.SH DESCRIPTION
These functions are easier to use than the standard interface.
.LP
.I Mseminit
creates a semaphore field of 
.I nsems 
semaphores with 
.I key
using
.I semperm
as permissions and initializes the semaphore field to the specified
values.  On success this function returns a valid descriptor for the
semaphore field.  In case a semaphore field with the specified key already exists,
.I mseminit
returns -1.
.LP
.I Msemgrab
delivers a valid descriptor for an 
.B already existing
semaphore field of at least 
.I nsems
semaphores.
.LP
.I MP
and
.I mV
perform a P resp. V operation on the 
semaphores indicated by the following
.I nsems 
arguments in the field
.I semid
atomically. Thus 
.EX
mP (semid, 3, 1, 0, 2)
.EE
is the same as 
.EX
P (semid1);
P (semid0);
P (semid2);
.EE
except that 
.B mP 
is an atomic action, whereas the three
\fBP\fR's
are not. Using the same index twice in a single call to 
.B mP
or
.B mV
results in undefined behaviour.
.LP
.I Msemrm
removes the semaphore field given by
.I semid.
.SH DIAGNOSTICS
All functions return -1 in case of error and set 
.B errno 
accordingly.
.SH COMPILING
You have to specify the library to the compiler, e.g.
.LP
c89 program.c 
.B -lsem182
.SH SEE ALSO
semget(2), semop(2), semctl(2), sem182(3)
.SH AUTHORS
.IP Implementation:
Peter Holzer (hp@vmars.tuwien.ac.at), by modifying an old version of
sem182 by
.br
Guenther Leber (guenther@vmars.tuwien.ac.at) and
.br
Heinz Kantz (kantz@vmars.tuwien.ac.at), which had also been modified
(the version, not Heinz) by
.br
Gustav Pospischil (gusti@vmars.tuwien.ac.at).
.IP "Manual page:"
Peter Holzer (hp@vmars.tuwien.ac.at), by modifying a quite recent version
of the manual page of sem182 by
Guenther Leber (guenther@vmars.tuwien.ac.at)
